<?php
class CPyramidAccountCrash extends Zend_Db_Table
{
	protected $_name = '';
	protected $_primary = '';
	
	public function __construct()
	{
		$this->_name = R_PRE . 'pyramid_account_crash';
		$this->_primary = 'crash_id';
		parent::__construct();
	}
	
	public function add($row)
	{
		return $this->insert($row);
	}
	
	public function getAll($page, $pageNum, $type)
	{
		$where = array();
		if ($type != 5) {
			$where['statu = ?'] = $type;
		}
		
		$offset = ($page - 1) * $pageNum;
		
		return $this->fetchAll($where, 'add_time desc', $pageNum, $offset);
	}
	
	public function getPageCount($pageNum, $type)
	{
		$where = array();
		if ($type != 5) {
			$where['statu = ?'] = $type;
		}
		
		$rows = $this->fetchAll($where);		
		return count($rows);
	}
}